#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int arr1[5];
    int arr2[5];
    int i,j,k;
    int s;
    for (i = 0;i < 5;i++)
        scanf("%d", &arr1[i]);
    for (j = 0;j < 5;j++)
        scanf("%d", &arr2[j]);
    for (k = 0;k < 5;k++) 
    {
        s = arr1[k];
        arr1[k] = arr2[k];
        arr2[k] = s;
    }
    for (k = 0;k < 5;k++)
        printf("%d ", arr1[k]);
    printf("\n");
    for (k = 0;k < 5;k++)
        printf("%d ", arr2[k]);
    return 0;
}